package accountManagement;

import java.io.Serializable;

public class Account implements Serializable{
	private static final long serialVersionUID = -9172915031867217674L;
	
	private String nickname;
	private String password;
	
	public Account() {
		
	}
	
	public Account(String nickname, String password) {
		this.setNickname(nickname);
		this.setPassword(password);
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	protected String getPassword() {
		return this.password;
	}

	public boolean checkPassword(String password) {
		return this.password.equals(password);
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public boolean equals(Account account) {
		return account != null && this.nickname.equalsIgnoreCase(account.getNickname());
	}
	
	@Override
	public boolean equals(Object object) {
		return object != null && object instanceof Account && this.equals((Account)object);
	}
	
	@Override
	public String toString() {
		return "Account[Nickname:" + this.getNickname() + ";Password:" + getPassword() + "]";
	}
}
